#ifndef CLIENTLOGIN_H
#define CLIENTLOGIN_H

#include <QWidget>

#include <QThread>
#include "client.h"
#include "clientread.h"
#include "clientwrite.h"
#include "logindialog.h"


QT_BEGIN_NAMESPACE
namespace Ui { class ClientLogin; }
QT_END_NAMESPACE

class ClientLogin : public QWidget
{
    Q_OBJECT

public:
    ClientLogin(QWidget *parent = nullptr);
    ~ClientLogin();
    LoginDialog* m_loginDialog;
private:
    Ui::ClientLogin *ui;
    int m_clientFd;

    QThread* m_clientThread;
    QThread* m_clientReadThread;
    QThread* m_clientWriteThread;
    Client* m_client;
    ClientRead* m_clientRead;
    ClientWrite* m_clientWrite;



    void initClient();
    void initUi();

    /* 槽函数 */
    void dealConnectStatus(int status);
    void dealThread();

signals:
    void startConnect();
    void startOperate(int clientFd);
    void stopThread();
    void sendMsg(QString myMsg);
};
#endif // CLIENTLOGIN_H
